package com.coursehub.course.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Objects;

/**
 * 班级资料关联复合主键
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Embeddable
public class ClassesMaterialId implements Serializable {
    
    @Column(name = "classes_id", length = 100)
    private String classesId;
    
    @Column(name = "material_id", length = 100)
    private String materialId;
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ClassesMaterialId that = (ClassesMaterialId) o;
        return Objects.equals(classesId, that.classesId) && 
               Objects.equals(materialId, that.materialId);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(classesId, materialId);
    }
}